package day05;

import java.util.Arrays;

public class ArrayDemo5 {
    //数组的复制
    public static void main(String[] args) {
        int[] a = {10,20,30,40,50};
        //a:源数组
        //b:目标数组
        //6:目标数组的长度
        int[] b = Arrays.copyOf(a,6);
        for(int i = 0; i < b.length; i++){
            System.out.println(b[i]);
        }
        System.out.println("-----------------------------");

        //数组扩容
        a = Arrays.copyOf(a,a.length + 1);
        for(int i = 0; i < a.length; i++){
            System.out.println(a[i]);
        }
    }
}
